package 接口红包案例;

import java.util.ArrayList;

public class NormalMode implements OpenMode {
    @Override
    public ArrayList<Integer> divide(final int totalMoney, final int totalCount) {
        ArrayList<Integer> list = new ArrayList<>();
        //平均值
        int avg = totalMoney / totalCount;
        int mod = totalMoney % totalCount;
        //除了最后一个的红包
        for (int i = 0; i < totalCount - 1; i++) {
            list.add(avg);
        }
        //最后一个含有零头的部分
        list.add(avg + mod);
        return list;
    }
}
